
<script>
    function checkAgentId(){
          $.ajax({
            url: "<?php echo base_url(); ?>index.php/agents/checkAgentId/"+$('#agent_id').val(),
            dataType:"json",
            success:function(data){
                $.each(data, function(i,n){
                    if (i==0){
                    alert ("ID "+$('#agent_id').val()+" sudah terdaftar");
                        $('#agent_id').val("");
                        $('#agent_id').focus();
                    }
                });
            },
            error: function(data){
                
            }
       });  
    }

	window.onload = function()
	{
		//getPosition();
		isSchool();
	}
	
/**
 * 	function getPosition(){			
 * 		var str = "";
 *         var index="";
 * 		var username_list = ['<?php// echo join("\", \"", $data[ 'maintain_name' ][ 'member_value' ]); ?>'];
 * 		var position_list = ['<?php// echo join("\", \"", $data[ 'maintain_name' ][ 'pos' ]); ?>'];
 * 		
 * 		var maintain_name = document.getElementById("maintain_name").value;
 * 	
 * 		for( var i = 0 ; i < username_list.length ; i++ )
 * 		{		
 * 			if( username_list[ i ] == maintain_name )
 * 			{
 * 				index = i;
 * 				break;
 * 			}
 * 		}
 * 		console.log(index);
 * 		document.getElementById( 'position' ).value ="Direct Sales"; //position_list[ index ];
 *     }
 */
	
	function getValue()
	{
		var etopup = document.getElementById( 'smart_check' ).checked;
		var smart_text = document.getElementById( 'smart_text' );
		var smart_div = document.getElementById( 'smart_div' );
		
		if( etopup == true )
		{
			smart_text.removeAttribute( "readonly", 0 );
			smart_text.removeAttribute( "style", 0 );
			smart_div.removeAttribute( "style", 0 );
		}
		else
		{
			smart_text.setAttribute( "readonly", "readonly" );
			smart_text.setAttribute( "style", "background-color:LightGray" );
			smart_div.setAttribute( "style", "background-color:LightGray" );
		}	
	}
	
	// function isSchool()
	// {	
	// 	var is_school = document.getElementById( 'is_school' );
	// 	var faculty_num = document.getElementById( 'faculty_num' );
	// 	var majority_num = document.getElementById( 'majority_num' );
	// 	var student_num = document.getElementById( 'student_num' );
	// 	var teacher_num = document.getElementById( 'teacher_num' );
	// 	var faculty_div = document.getElementById( 'faculty_div' );
	// 	var majority_div = document.getElementById( 'majority_div' );
	// 	var student_div = document.getElementById( 'student_div' );
	// 	var teacher_div = document.getElementById( 'teacher_div' );
		
		
		
	// 	if( is_school.checked == true )
	// 	{
	// 		faculty_num.removeAttribute( 'readonly', 0 );
	// 		majority_num.removeAttribute( 'readonly', 0 );
	// 		student_num.removeAttribute( 'readonly', 0 );
	// 		teacher_num.removeAttribute( 'readonly', 0 );
			
	// 		faculty_num.removeAttribute( 'style', 0 );
	// 		majority_num.removeAttribute( 'style', 0 );
	// 		student_num.removeAttribute( 'style', 0 );
	// 		teacher_num.removeAttribute( 'style', 0 );
			
	// 		faculty_div.removeAttribute( "style", 0 );
	// 		majority_div.removeAttribute( "style", 0 );
	// 		student_div.removeAttribute( "style", 0 );
	// 		teacher_div.removeAttribute( "style", 0 );
			
	// 		is_school.value = 1;
	// 	}
	// 	else
	// 	{
	// 		faculty_num.setAttribute( 'readonly', 'readonly' );
	// 		faculty_num.setAttribute( "style", "background-color:LightGray" );
	// 		faculty_div.setAttribute( "style", "background-color:LightGray" );
	// 		faculty_num.value="";
	// 		majority_num.setAttribute( 'readonly', 'readonly' );
	// 		majority_num.setAttribute( "style", "background-color:LightGray" );
	// 		majority_div.setAttribute( "style", "background-color:LightGray" );
	// 		majority_num.value="";
	// 		student_num.setAttribute( 'readonly', 'readonly' );
	// 		student_num.setAttribute( "style", "background-color:LightGray" );
	// 		student_div.setAttribute( "style", "background-color:LightGray" );
	// 		student_num.value="";
	// 		teacher_num.setAttribute( 'readonly', 'readonly' );
	// 		teacher_num.setAttribute( "style", "background-color:LightGray" );
	// 		teacher_div.setAttribute( "style", "background-color:LightGray" );
	// 		teacher_num.value="";
			
	// 		is_school.value = 0;
	// 	}
	// }
	
	function fillName()
	{
		var pic_name_agent = document.getElementById( "pic_name_agent" ).value;
		var pic_phone_agent = document.getElementById( "pic_phone_agent" ).value;
		
		document.getElementById( "pic_name" ).value = pic_name_agent;
		document.getElementById( "pic_phone_no" ).value = pic_phone_agent;
	}
</script>
<link rel="stylesheet" type="text/css" href="<?= base_url() ?>file/js/easyui/themes/gray/easyui.css"> 

<div class="box-left">
	<div class="form">
		<div class="fields">
			<div class="panel-wrap" style="height: auto">	
				<div class="panel-header-div">Informasi Wilayah (Teritory Information)</div>
				<div class="panel-body-div">
					<div class="left-panel-body" style="margin-left: 20%">
						<br/><br/>
						<h6><?=$data[ 'tr_path' ][ 'member_display' ]?></h6>
					</div>
				</div>
			</div>
			
			<div class="panel-wrap" style="height: auto">	
				<div class="panel-header-div">Data Agen/Data lokasi</div>
				<div class="panel-body-div" style="height: 500px">
					<div class="left-panel-body" style="width: 90%">
 
<table class="data-agen">
<tr>
    <td width="35%">Agent ID</td>
    <td>: 
    <input type="text"  name="agent_id" id="agent_id" value="<?=$agent_id?>" style="background-color:LightGray"  readonly="readonly" /></td>
</tr>

<tr>
    <td>Tipe Penjualan</td>
    <td>: 
        <input type="text" value="<?=$data['a_status']['member_display'][$agent_selling_type]?>" style="background-color:LightGray"   readonly="readonly"  />
    </td>
</tr>

<tr>
    <td>Tipe Agen/Lokasi</td>
    <td>: 
        <input type="text" value="<?=$agent_status?>" readonly="readonly" style="background-color:LightGray"   />
      
    </td>
</tr>

<tr>
    <td>Nama Agen/Lokasi</td>
    <td>: <input type="text" maxlength="255" name="agent_name" value="<?=$agent_name?>" style="background-color:LightGray"  readonly="readonly"  /></td>
</tr>

<tr>
    <td>Alamat Agen/Lokasi *</td>
    <td>&nbsp; <textarea maxlength="255" rows="3" name="agent_address" cols="40" style="background-color:LightGray;"  readonly="readonly" ><?=$agent_address?></textarea></td>
</tr>

<tr>
    <td>Kota</td>
    <td>: <input type="text" name="agent_city" maxlength="100" value="<?=$agent_city?>" style="background-color:LightGray"  class="small" readonly="readonly"  /></td>
</tr>

<tr>
    <td>Provinsi</td>
    <td>:
        <input type="text" value="<?=$data['province']['member_display'][$agent_province-1]?>" style="background-color:LightGray"  readonly="readonly" />
    </td>
</tr>

<tr>
    <td>Kode Pos</td>
    <td>: <input type="text" maxlength="10" name="agent_zip_code" value="<?=$agent_zip_code?>" style="background-color:LightGray"  class="small" readonly="readonly"  /></td>
</tr>

<tr>
    <td>Nomor Telepon</td>
    <td>: <input type="text" maxlength="20" name="agent_phone_no" value="<?=$agent_phone_no?>"  style="background-color:LightGray" class="small" readonly="readonly"  /></td>
</tr>

<tr>
    <td><abbr alt="Nomor telpon yang dipakai untuk mengisi ulang pulsa" >MDN EVO</abbr></td>
    <td>: <input type="text" maxlength="50" name="mdn_evo" value="<?=$agent_mdn_evo?>" class="small" style="background-color:LightGray"  readonly="readonly"  /></td>
</tr>
<!--
<tr>
    <td>Nama yang Berwenang (PIC)</td>
    <td>: <input type="text" maxlength="30" id="pic_name_agent" name="pic_name_agent" value="<?=$pic_name?>" class="small" onkeyup="fillName()" /></td>
</tr>

<tr>
    <td>Nomor Telepon PIC</td>
    <td>: <input type="text" maxlength="20" id="pic_phone_agent" name="pic_phone_agent" value="<?=$pic_phone?>" class="small" onkeyup="fillName()"/></td>
</tr>
-->
<tr>
    <td>Gambar Profile</td>
    <?php
        if( $image == "" )
        {
            $href = "";
            $text = "-";
        }
        else
        {
            $href = base_url()."file/agent/".$image;
            $text = $image;
        }
    ?>
    <td>: <a href="<?=$href?>" target="_blank"><?=$text?></a></td>
</tr>
</table>    

					</div>					
				</div>
			</div>
		</div>
	</div>
</div>
<div class="box-right">
	<div class="form">
		<div class="fields">
			<div class="panel-wrap" style="height: auto">	
				<div class="panel-header-div">Informasi Pengelola</div>
				<div class="panel-body-div">
					<div class="left-panel-body" style="width: 80%">
						<div class="field">			
							<div class="label">
								<label for="name">Nama:</label>
							</div>
							<div class="select_in">
                            <input type="text" value="<? print_r ($maintain_name)?>" readonly="readonly" style="background-color:LightGray"  />
							
							</div>
						</div>
						<div class="field">
							<div class="label">
								<label for="position">Jabatan:</label>
							</div>
							<div class="input" style="background-color:LightGray">
								<input type="text" id="position"
								readonly="readonly" style="background-color:LightGray"  value="Direct Sales" />
							</div>
						</div>
					</div>
				</div>
			</div>
			
			<div class="panel-wrap" style="height: auto">	
				<div class="panel-header-div">Informasi Tambahan</div>
				<div class="panel-body-div" style="height: 500px">
					<div class="left-panel-body" style="width: 80%">

<table class="data-agen">
    <tr>
        <td width="35%">Websites</td>
        <td><input type="text" maxlength="50" name="agent_website" value="<?=$agent_website?>" style="background-color:LightGray"  class="small" readonly="readonly"  /></td>
    </tr>
    
    <!-- <tr>
        <td>Akademi Pendidikan ?</td>
        <td>
            <input type="checkbox" name="is_school" id="is_school"
                <?php if( $is_school == 1 )
                        echo 'checked="checked"';
                ?> onchange="isSchool()"/>
        </td>
    </tr>
    
    <tr>
        <td>Jumlah Fakultas</td>
        <td><input type="text" name="faculty_num" id="faculty_num" value="<?=$faculty_num?>" style="background-color:LightGray" readonly="readonly" class="small" /></td>
    </tr>
    
    <tr>
        <td>Jumlah Jurusan</td>
        <td><input type="text" name="majority_num" id="majority_num" style="background-color:LightGray" readonly="readonly" value="<?=$majority_num?>" class="small" /></td>
    </tr>
    
    <tr>
        <td>Jumlah Siswa</td>
        <td><input type="text" name="student_num" id="student_num" style="background-color:LightGray" readonly="readonly" value="<?=$student_num?>" class="small" /></td>
    </tr>
    
    <tr>
        <td>Jumlah Pengajar</td>
        <td><input type="text" name="teacher_num" id="teacher_num" style="background-color:LightGray" readonly="readonly" value="<?=$teacher_num?>" class="small" /></td>
    </tr>
    
    <tr>
        <td>Jumlah Pegawai</td>
        <td><input type="text" name="employee_num" value="<?=$employee_num?>" class="small" /></td>
    </tr> -->
    
    <tr>
        <td>Lokasi Agen</td>
        <td>
            <input type="text" value="<?=$agent_location;?>" readonly="readonly" style="background-color:LightGray"   />
            
        </td>
    </tr>
    
    <tr>
        <td>Fokus Bisnis</td>
        <td>
            <input type="text" value="<?=$agent_business_focus;?>" readonly="readonly" style="background-color:LightGray"  />
            
        </td>
    </tr>

</table>


					</div>
				</div>						
			</div>
		</div>
	</div>
</div>

